from django.db import models

class Group(models.Model):  
    name = models.CharField(max_length=200)
    active = models.SmallIntegerField()
    created_at = models.DateTimeField(null=True)
    updated_at = models.DateTimeField(null=True) 
    
    def __unicode__(self):
        return self.name

class Location(models.Model):  
    name = models.CharField(max_length=200)
    active = models.SmallIntegerField()
    created_at = models.DateTimeField(null=True)
    updated_at = models.DateTimeField(null=True) 
    
    def __unicode__(self):
        return self.name    
    
class Customer(models.Model):
    name = models.CharField(max_length=200)
    telephone = models.TextField()
    location = models.ForeignKey(Location)
    group = models.ForeignKey(Group)
    active = models.SmallIntegerField()
    created_at = models.DateTimeField(null=True)
    updated_at = models.DateTimeField(null=True)
    
    def __unicode__(self):
        return self.name